#!/bin/bash

echo "[AppRun ] GameHub AppImage"
echo "[AppRun ] AppDir: $APPDIR"

export LD_LIBRARY_PATH="$APPDIR/usr/lib:$LD_LIBRARY_PATH"
export PATH="$APPDIR/usr/bin:$PATH"
export XDG_DATA_DIRS="$APPDIR/usr/share:$XDG_DATA_DIRS"

export GSETTINGS_SCHEMA_DIR="$APPDIR/usr/share/glib-2.0/schemas/:$GSETTINGS_SCHEMA_DIR"

export LD_LIBRARY_PATH="$APPDIR/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0:$LD_LIBRARY_PATH"

[ -e "$APPDIR/checkrt.sh" ] && . "$APPDIR/checkrt.sh" || echo "[AppRun ] Skipping CheckRT"

echo "[AppRun ] Starting GameHub"

cd "$APPDIR/usr"
"$APPDIR/usr/bin/com.github.tkashkin.gamehub" "$@"
